package net.superdvach.network;

import java.io.IOException;
import java.util.ArrayList;

import net.i2p.I2PException;
import net.superdvach.core.Config;

public class NetworkLayerManager {

	public NetworkLayerManager() {
		m_layers = new ArrayList<NetworkLayer>();
	}
	
	public int layerCount() {
		return m_layers.size();
	}
	
	public NetworkLayer layer(int index) {
		return m_layers.get(index);
	}
	
	public ArrayList<String> availableLayers() {
		ArrayList<String> array = new ArrayList<String>();
		array.add("i2p");
		return array;
	}
	
	public boolean createLayer(String layerType, String parameter) {
		if(layerType.equals("i2p")) {
			try {
				m_layers.add(new I2PNetworkLayer(parameter));
			} catch (I2PException e) {
				return false;
			} catch (IOException e) {
				return false;
			}
			return true;
		}
		return false;
	}
	
	public boolean save(Config config) {
		return true;
	}
	
	public boolean load(Config config) {
		return true;
	}
	
	private ArrayList<NetworkLayer> m_layers;
}
